using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace NPC.Enemy
{
    public class BOSSStateMachine : StateMachine
    {
        [SerializeField] private BossAgent agent;
        [SerializeField] BOSSState[] states; // State资源文件

        void Awake()
        {
            agent = gameObject.GetComponent<BossAgent>();
            
            stateTable = new Dictionary<Type, IState>(states.Length);

            // 迭代器循环获取状态
            foreach (BOSSState state in states)
            {
                // 将动画组件，刚体组件以及StateMachine传入进去
                state.Initiatize(agent, this);
                // 状态存入字典
                stateTable.Add(state.GetType(), state);
            }
        }

        private void Start()
        {
            // 在开始时执行HTN
            SwitchOn(stateTable[typeof(BOSSState_HTN)]);
        }
    }
}
